package com.koocloud.electroplatemanage.pojo;

import java.util.Comparator;
import java.util.List;


public class User {
    /*@userId 用户id*/
    private long id;
    /*@userName 用户姓名  根据这个判断非空*/
    private String username;
    /*@fullname 用户姓名显示用户姓名汉字*/
    private String fullname;
    /*@loginId 用户登录工号*/
    private String jobNum;
    /*@password 用户密码*/
    private String password;
    /*@roleId 注册手机号*/
    private String regPhone;
    /*@enableFlag 是否启用标识*/
    private int enableFag;

    private long superiorId;//所属上级的id

    private List<User> children;

    private String roleListStr;//该用户所拥有的角色集合字符串(用逗号进行分割之后的)
    private String departmentId; // 部门
    private String departmentName; // 部门名称


    /*
     * 排序,根据superiorId排序
     */
    public static Comparator<User> order() {
        Comparator<User> comparator = new Comparator<User>() {
            @Override
            public int compare(User u1, User u2) {
                if (u1.getSuperiorId() != u2.getSuperiorId()) {
                    return (int) (u1.getSuperiorId() - u2.getSuperiorId());
                }
                return 0;
            }
        };
        return comparator;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", fullname='" + fullname + '\'' +
                ", jobNum='" + jobNum + '\'' +
                ", password='" + password + '\'' +
                ", regPhone='" + regPhone + '\'' +
                ", enableFlag=" + enableFag +
                ", superiorId=" + superiorId +
                ", children=" + children +
                ", roleListStr='" + roleListStr + '\'' +
                ", departmentId='" + departmentId + '\'' +
                '}';
    }

    public String getDepartmentName() {
        return departmentName;
    }

    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getJobNum() {
        return jobNum;
    }

    public void setJobNum(String jobNum) {
        this.jobNum = jobNum;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRegPhone() {
        return regPhone;
    }

    public void setRegPhone(String regPhone) {
        this.regPhone = regPhone;
    }

    public int getEnableFag() {
        return enableFag;
    }

    public void setEnableFag(int enableFlag) {
        this.enableFag = enableFlag;
    }

    public long getSuperiorId() {
        return superiorId;
    }

    public void setSuperiorId(long superiorId) {
        this.superiorId = superiorId;
    }

    public List<User> getChildren() {
        return children;
    }

    public void setChildren(List<User> children) {
        this.children = children;
    }

    public String getRoleListStr() {
        return roleListStr;
    }

    public void setRoleListStr(String roleListStr) {
        this.roleListStr = roleListStr;
    }

    public String getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(String departmentId) {
        this.departmentId = departmentId;
    }
}
